package com.hz.user.interfaces.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hz.base.beans.vo.CommonResult;
import com.hz.base.beans.vo.PageEntity;
import com.hz.base.beans.vo.QueryParams;
import com.hz.beans.code.HzOperateCode;
import com.hz.beans.user.entity.BaseUser;
import com.hz.common.beans.constant.DemoResult;
import com.hz.interfaces.user.inf.IBaseUserInterface;
import com.hz.user.service.inf.IBaseUserService;

/**
 * IBaseUserService
 * @author liul
 * @since [0.0.1]
 * @version [0.0.1,2018年09月11日]
 */
@Service("baseUserInterface")
public class BaseUserInterface implements IBaseUserInterface{
	
	@Autowired
	private IBaseUserService baseUserService;
	

	@Override
	public CommonResult<BaseUser> queryBaseUser(Long id) {
		CommonResult<BaseUser> cr = new DemoResult<>();
		cr = baseUserService.selectByPrimaryKey(cr,id);
		cr.setOperate(HzOperateCode.QUERY_BASEUSER);
		return cr;
	}

	@Override
	public CommonResult<BaseUser> addBaseUser(BaseUser baseUser) {
		CommonResult<BaseUser> cr = new DemoResult<>();
		cr = baseUserService.insert(cr, baseUser);
		cr.setOperate(HzOperateCode.ADD_BASEUSER);
		return cr;
	}
	
	@Override
	public CommonResult<PageEntity> queryForPage(QueryParams<BaseUser> queryParams) {
		CommonResult<PageEntity> cr = new DemoResult<>();
		cr = baseUserService.queryForPage(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_BASEUSER_PAGE);
		return cr;
	}

	@Override
	public CommonResult<List<BaseUser>> queryBaseUserList(QueryParams<BaseUser> queryParams) {
		CommonResult<List<BaseUser>> cr = new DemoResult<>();
		cr = baseUserService.queryForList(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_BASEUSER_LIST);
		return cr;
	}

	@Override
	public CommonResult<BaseUser> updateBaseUser(BaseUser baseUser) {
		CommonResult<BaseUser> cr = new DemoResult<>();
		cr = baseUserService.updateByPrimaryKey(cr, baseUser);
		cr.setOperate(HzOperateCode.UPDATE_BASEUSER);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteBaseUserArray(Long[] ids) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = baseUserService.deleteObjectArray(cr, ids);
		cr.setOperate(HzOperateCode.DELETE_BASEUSER);
		return cr;
	}

	@Override
	public CommonResult<BaseUser> insertSelective(BaseUser baseUser) {
		CommonResult<BaseUser> cr = new DemoResult<>();
		cr = baseUserService.insertSelective(cr, baseUser);
		cr.setOperate(HzOperateCode.INSERTSELECTIVE_BASEUSER);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteByList(List<BaseUser> baseUserList) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = baseUserService.deleteByList(cr, baseUserList);
		cr.setOperate(HzOperateCode.DELETELIST_BASEUSER);
		return cr;
	}

	@Override
	public CommonResult<List<BaseUser>> batchUpdate(List<BaseUser> baseUserList) {
		CommonResult<List<BaseUser>> cr = new DemoResult<>();
		cr = baseUserService.batchUpdate(cr, baseUserList);
		cr.setOperate(HzOperateCode.BATCHUPDATE_BASEUSER);
		return cr;
	}

	@Override
	public CommonResult<List<BaseUser>> batchSave(List<BaseUser> baseUserList) {
		CommonResult<List<BaseUser>> cr = new DemoResult<>();
		cr = baseUserService.batchSave(cr, baseUserList);
		cr.setOperate(HzOperateCode.BATCHSAVE_BASEUSER);
		return cr;
	}

}
